<?php
/* -=-=-=-=-=-=-=-=-=-=-=-=-
     author by terry
-=-=-=-=-=-=-=-=-=-=-=-=- */
error_reporting(7);
require "global.php";

//change status
if($_GET[changeid]!=''){
   if($_GET[changeid]=='3'){
	        $list_mail = $DB->fetch_one_array("SELECT * FROM pa_recuiter WHERE rc_id = '".$_GET[id]."'");
            $subject  = "Your Premium Recruiter Membership Is Now Active";
			$content  = "Congratulations!  Your account has been approved for Premium Membership!  Within 24 hours your account will be upgraded to our Premium Membership level.  As a Premium Membership holder, you may submit candidates to open jobs, post jobs and create chats on our site.  So get started, have fun and we wish you many successful placements on enetRecruiter! 
			<br><br>
			If you have any questions about your account or how to get started please send an email to <a href='mailto:support@enetrecruiter.com'>support@enetrecruiter.com</a> or contact your account manager.  For immediate answers, you are welcome to visit the HELP pages.  
			<br><br>
			--enetRecruiter Membership Support Team<br><br>

			<a href='http://www.enetrecruiter.com'>www.enetrecruiter.com</a>";
			$headers .= "From: enetRecruiter Support <support@enetrecruiter.com>" . "\r\n";
			$headers .= "Content-type: text/html; charset=utf-8" . "\r\n";
			if(!ereg("^[a-zA-Z0-9][a-zA-Z0-9_\.]+[a-zA-Z0-9]@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-\.]+$",$list_mail[rc_email])){
			   echo "<font color=red>Invalid Email Address, Please Check the Recruiter's Email Address</a>";
			   exit;
			}else{
            $to       =  $list_mail[rc_email];
			
			$sql = "UPDATE pa_recuiter SET `rc_status`='".$_GET[changeid]."'  WHERE rc_id ='".$_GET[id]."' ";
			$DB->query($sql);

            }
			@mail($to, $subject, $content, $headers);

   }elseif($_GET[changeid]=='2'){
	        $list_mail = $DB->fetch_one_array("SELECT * FROM pa_recuiter WHERE rc_id = '".$_GET[id]."'");
            $subject  = "Your Executive Membership Account is Now Active";
			$content  = "Congratulations! Your Executive Membership account has been activated. We look forward to you joining and contributing to our growing community! Please feel free to send us emails if you have questions or feedback at <a href='mailto:service@enetrecruiter.com'>service@enetrecruiter.com</a>.
			<br><br>
			The enetRecruiter Support Team<br>
			<a href='http://www.enetrecruiter.com'>www.enetrecruiter.com</a>
			<br><br>
			<i><font color='grey' style='font-size:10px'>NOTE: enetRecruiter reserves the right to refuse or revoke membership to anyone for any reason</font></i>";

			$headers .= "From: enetRecruiter Support <support@enetrecruiter.com>" . "\r\n";
			$headers .= "Content-type: text/html; charset=utf-8" . "\r\n";
			if(!ereg("^[a-zA-Z0-9][a-zA-Z0-9_\.]+[a-zA-Z0-9]@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-\.]+$",$list_mail[rc_email])){
			   echo "<font color=red>Invalid Email Address, Please Check the Recruiter's Email Address</a>";
			   exit;
			}else{
            $to       =  $list_mail[rc_email];
			
			$sql = "UPDATE pa_recuiter SET `rc_status`='".$_GET[changeid]."'  WHERE rc_id ='".$_GET[id]."' ";
			$DB->query($sql);

            }
			@mail($to, $subject, $content, $headers);

   }elseif($_GET[changeid]=='1'){
		$list_mail = $DB->fetch_one_array("SELECT * FROM pa_recuiter WHERE rc_id = '".$_GET[id]."'");
		$subject  = "Your Director Membership Account is Now Active";
		$content  = "Congratulations! Your Director Membership account has been activated. We look forward to you joining and contributing to our growing community! Please feel free to send us emails if you have questions or feedback at <a href='mailto:service@enetrecruiter.com'>service@enetrecruiter.com</a>.
		<br><br>
		The enetRecruiter Support Team<br>
		<a href='http://www.enetrecruiter.com'>www.enetrecruiter.com</a>
		<br><br>
		<i><font color='grey' style='font-size:10px'>NOTE: enetRecruiter reserves the right to refuse or revoke membership to anyone for any reason</font></i>";
		$headers .= "From: enetRecruiter Support <account@enetrecruiter.com>" . "\r\n";
		$headers .= "Content-type: text/html; charset=utf-8" . "\r\n";
		if(!ereg("^[a-zA-Z0-9][a-zA-Z0-9_\.]+[a-zA-Z0-9]@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-\.]+$",$list_mail[rc_email])){
		   echo "<font color=red>Invalid Email Address, Please Check the Recruiter's Email Address</a>";
		   exit;
		}else{
		
		$to =  $list_mail[rc_email];
		
		$sql = "UPDATE pa_recuiter SET `rc_status`='".$_GET[changeid]."'  WHERE rc_id ='".$_GET[id]."' ";
		$DB->query($sql);

		}
		@mail($to, $subject, $content, $headers);
   }else{
			$sql = "UPDATE pa_recuiter SET `rc_status`='".$_GET[changeid]."'  WHERE rc_id ='".$_GET[id]."' ";
			$DB->query($sql);
   }
   $_GET[action]="list";
}


cpheader();
//set offset
if(!empty($rs[rc_offset]))
{$offset = $rs[rc_offset];}
else if  (!empty($_GET[offset]))
{$offset = $_GET[offset]; }
else  {$offset = 0; }


if ($_GET[action]=="add"||$_GET[action]=='mod'||$_GET[action]=='view'){

    $cpforms->inithtmlarea();
	if($_GET[action]=="add"){
			$cpforms->formheader(array('title'=>'Add New Recruiter (<font color=red>*</font>=Required Field)',
										'name'=>'article',
			                             'enctype'=>'multipart/form-data'));

			$cpforms->makehidden(array('name'=>'action',
									   'value'=>'doinsert'));
			$rs[rc_StartDate] = $rs[rc_EndDate] = time();
	}
	if($_GET[action] == "mod"){
			$cpforms->formheader(array('title'=>'Modify Recruiter (<font color=red>*</font>=Required Field)',
										'name'=>'article',
				                        'enctype'=>'multipart/form-data'));

			$cpforms->makehidden(array('name'=>'action',
									   'value'=>'update'));
		    $recuiterid = intval($_GET[id]);
			$cpforms->makehidden(array('name'=>'id',
									   'value'=>$recuiterid));
			$cpforms->makehidden(array('name'=>'offset',
									   'value'=>$offset));
            $read =1;
	        $rs  = $DB->fetch_one_array("SELECT * FROM ".$db_prefix."recuiter WHERE rc_id =".$recuiterid);
	}

	if($_GET[action]=="view"){
				$cpforms->formheader(array('title'=>'View Recruiter (<font color=red>*</font>=Required Field)',
										'name'=>'article',
				                        'enctype'=>'multipart/form-data'));
		    $recuiterid = intval($_GET[id]);
			$cpforms->makehidden(array('name'=>'id',
									   'value'=>$recuiterid));
			$cpforms->makehidden(array('name'=>'offset',
									   'value'=>$offset));
            $view =1;
	        $rs  = $DB->fetch_one_array("SELECT * FROM ".$db_prefix."recuiter WHERE rc_id =".$recuiterid);
	}

	
	?>
     <?       
	       $cpforms->gethightext(array('text'=>"√Username",'name'=>"user_name",'only'=>1,'value'=>"$rs[rc_uname]",'read'=>"$read",'view'=>"$view",'icon'=>"'Username is 6-12 Characters and is Case Sensitive.', WIDTH, 200, SHADOW, true"));
	       $cpforms->gethightext(array('text'=>"Password",'name'=>"password",'type'=>"password",'only'=>1,'view'=>"$view",'icon'=>"'Password is 6-12 Characters and is Case Sensitive.', WIDTH, 200, SHADOW, true"));
		   
		   $cpforms->longline(array('title'=>"User Information"));
		   $cpforms->gethightext(array('text'=>"√Your First Name",'name'=>"firstname",'only'=>1,'value'=>"$rs[rc_fname]",'view'=>"$view"));
		   $cpforms->gethightext(array('text'=>"√Your Last Name", 'name'=>"lastname",'only'=>1,'value'=>"$rs[rc_lname]",'view'=>"$view"));
           $cpforms->gethightext(array('text'=>"√Your Email Address", 'name'=>"email",'only'=>1,'value'=>"$rs[rc_email]",'view'=>"$view"));
		   $cpforms->gethightext(array('text'=>"√Your Phone", 'name'=>"phone",'only'=>1,'value'=>"$rs[rc_phone]",'view'=>"$view"));
		   $cpforms->gethightext(array('text'=>"√Your Fax", 'name'=>"fax",'value'=>"$rs[rc_fax]",'view'=>"$view"));
		   $cpforms->gethightext(array('text'=>"√Your Job Title", 'name'=>"jobtitle",'only'=>1,'value'=>"$rs[rc_title]",'view'=>"$view"));
		   $cpforms->gethightext(array('text'=>"√Your Skype ID", 'name'=>"skype",'value'=>"$rs[rc_skype]",'view'=>"$view",'icon'=>"' If you do not have a Skype ID, you may complete this field later.  To get FREE Skype, <a href=\'http://www.skype.com/download\'>Go Here</a>', WIDTH, 200, TITLE,'', SHADOW, true, FADEIN, 100, FADEOUT, 100, STICKY, 1,  CLOSEBTN, true, CLICKCLOSE, true"));
		   $cpforms->gethightext(array('text'=>"√Your spoken language(s)",'name'=>"spokenlanguage",'only'=>1,'value'=>"$rs[rc_spokenlanguage]",'view'=>"$view"));
		   $cpforms->gethightext(array('text'=>"√Years of recruiting experience",'name'=>"recruitex",'only'=>1,'value'=>"$rs[rc_recruitex]",'view'=>"$view"));
           $cpforms->maketextarea(array('text'=>"√Please write a brief description about you or your company here)",'name'=>"description",'value'=>"$rs[rc_description]",'view'=>"$view" ,'icon'=>"'Please describe in 500 characters or less.  You may edit this later.', WIDTH, 200, SHADOW, true"));
		   $cpforms->gethighradio(array('text'=>"Would you like to subscribe to our newsletter",'name'=>"newsmailist",'only'=>1,'selected'=>"$rs[rc_newsmailist]",'view'=>"$view"));
		   $cpforms->gethightext(array('text'=>"How did you hear about us?",'name'=>"howus",'only'=>1,'value'=>"$rs[rc_howus]",'view'=>"$view"));
		   $cpforms->gethightext(array('text'=>"Service Code",'name'=>"servicecode",'value'=>"$rs[rc_servicecode]",'view'=>"$view",'icon'=>"'If you have a service code please enter it here.', WIDTH, 200, SHADOW, true"));
		   $cpforms->makefile(array('text'=>"√Picture (Only accept image size less than 50KB.)",'name'=>"uploadfile",'url'=>"uploadfiles/recruiter/", 'value'=>"$rs[rc_uploadfile]",'view'=>"$view"));
		   		   
		   $cpforms->longline(array('title'=>"Company Information"));		   
		   $cpforms->gethightext(array('text'=>"√Company Name", 'name'=>"companyname",'only'=>1,'value'=>"$rs[rc_copname]",'view'=>"$view"));
		   $cpforms->gethightext(array('text'=>"√Company Website URL",'name'=>"companyurl",'value'=>"$rs[rc_website]",'view'=>"$view",'icon'=>"'Just type in <font color=blue>http://www.yourdomainname.com</font> here.', WIDTH, 200, SHADOW, true",'prevalue'=>"http://"));
		   $cpforms->makeselect(array('text'=>"√Industry", 'name'=>"industry",'only'=>1,'option'=>$jobcategory,'selected'=>"$rs[rc_industry]",'view'=>"$view",'viewfunction'=>'jobcategory'));
		   $cpforms->gethightext(array('text'=>"Company Size", 'name'=>"companysize",'only'=>1,'value'=>"$rs[rc_copsize]",'view'=>"$view",'icon'=>"'Enter an estimated number of full time employees.', WIDTH, 200, SHADOW, true"));
		   $cpforms->gethightext(array('text'=>"√Address",'name'=>"address",'only'=>1,'value'=>"$rs[rc_address1]",'view'=>"$view"));
		   $cpforms->gethightext(array('text'=>"√Location - City",'name'=>"locity",'only'=>1,'value'=>"$rs[rc_city]",'view'=>"$view"));
		   $cpforms->makeselect(array('text'=>"√Location - State", 'name'=>"lostate",'only'=>1,'option'=>$state,'selected'=>"$rs[rc_state]",'view'=>"$view",'viewfunction'=>'state'));
		   $cpforms->gethightext(array('text'=>"√Location - Zip Code",'name'=>"zip",'only'=>1,'value'=>"$rs[rc_zip]",'view'=>"$view"));
		   $cpforms->makeselect(array('text'=>"√Location - Country",'name'=>"locountry",'only'=>1,'option'=>$country,'selected'=>"$rs[rc_country]",'view'=>"$view",'viewfunction'=>'country'));
           $cpforms->makeselect(array('text'=>"√Your General Service Area",'name'=>"generalarea",'only'=>1,'option'=>$service,'selected'=>"$rs[rc_generalarea]",'view'=>"$view",'viewfunction'=>'service'));
		   $cpforms->makeselect(array('text'=>"√Your Primary Service Area (State)",'name'=>"pristate",'only'=>1,'option'=>$state,'selected'=>"$rs[rc_pristate]",'view'=>"$view",'viewfunction'=>'state'));
		   $cpforms->makeselect(array('text'=>"√Your Primary Service Area (Country)",'name'=>"pricountry",'only'=>1,'option'=>$country,'selected'=>"$rs[rc_pricountry]",'view'=>"$view",'viewfunction'=>'country'));
		   $cpforms->gethightext(array('text'=>"√If service area is outside of the U.S., please indicate location",'name'=>"indicate",'value'=>"$rs[rc_indicate]",'view'=>"$view"));
		   $cpforms->makeselect(array('text'=>"√Which job function do you recruit the most",'name'=>"recruit",'only'=>1,'option'=>$jobfunction,'selected'=>"$rs[rc_recruit]",'view'=>"$view",'viewfunction'=>'jobfunction','icon'=>"'Please select an area of specialty.', WIDTH, 200, SHADOW, true"));
		   $cpforms->gethighradio(array('text'=>"Are you open to job share/split?",'name'=>"share",'only'=>1,'selected'=>"$rs[rc_share]",'view'=>"$view"));
		   $cpforms->gethighradio(array('text'=>"Are you in business for yourself?",'name'=>"business",'only'=>1,'selected'=>"$rs[rc_business]",'view'=>"$view"));
		   $cpforms->longline(array('title'=>"My Links"));		   
		   $cpforms->gethightext(array('text'=>"√My Top 3 Clients(1)",'name'=>"myclient1",'value'=>"$rs[rc_top3_1]",'view'=>"$view"));
		   		  
		   $cpforms->longline(array('title'=>"Business Information"));			   
		   $cpforms->gethightext(array('text'=>"Business License Number", 'name'=>"licensenumber",'only'=>1,'value'=>"$rs[rc_license]",'view'=>"$view",'icon'=>"'  Please note you must provide a copy of your valid business license (or tax certificate) to us when requested by an enetRecruiter representative.  A failure to do so will delay your approval process and/or subject your account to suspension until we receive a valid copy. ', WIDTH, 200, TITLE,'', SHADOW, true, FADEIN, 100, FADEOUT, 100"));
		   $cpforms->gethightext(array('text'=>"Business License Issuing City, State, Country", 'name'=>"licenseissue",'only'=>1,'value'=>"$rs[rc_license_Issue]",'view'=>"$view",'icon'=>"' Please indicate the city, state and country in which your business license was issued.', WIDTH, 200, TITLE,'', SHADOW, true, FADEIN, 100, FADEOUT, 100"));
		   $cpforms->gethightext(array('text'=>"Federal Tax ID#", 'name'=>"licensephone",'only'=>1,'value'=>"$rs[rc_license_office]",'view'=>"$view",'icon'=>"' Please enter your Federal Tax ID#.', WIDTH, 200, TITLE,'', SHADOW, true, FADEIN, 100, FADEOUT, 100"));
		   $cpforms->longline(array('title'=>"Professional Reference "));		   
		   $cpforms->smallline(array('title'=>"1st Reference"));	
		   $cpforms->gethightext(array('text'=>"Company Name ",'name'=>"companyname1",'value'=>"$rs[rc_pr1_cpname]",'view'=>"$view",'only'=>1));
		   $cpforms->gethightext(array('text'=>"Contact Name ",'name'=>"contactname1",'value'=>"$rs[rc_pr1_ctname]",'view'=>"$view",'only'=>1));
		   $cpforms->gethightext(array('text'=>"Phone Number ",'name'=>"phonenumber1",'value'=>"$rs[rc_pr1_phone]",'view'=>"$view",'only'=>1));
		   $cpforms->gethightext(array('text'=>"Email ",'name'=>"email1",'value'=>"$rs[rc_pr1_email]",'view'=>"$view",'only'=>1));
		   $cpforms->gethightext(array('text'=>"Relationship",'name'=>"relationship1",'value'=>"$rs[rc_pr1_relationship]",'view'=>"$view",'only'=>1));
		   $cpforms->smallline(array('title'=>"2nd Reference"));
		   $cpforms->gethightext(array('text'=>"Company Name ",'name'=>"companyname2",'value'=>"$rs[rc_pr2_cpname]",'view'=>"$view",'only'=>1));
		   $cpforms->gethightext(array('text'=>"Contact Name ",'name'=>"contactname2",'value'=>"$rs[rc_pr2_ctname]",'view'=>"$view",'only'=>1));
		   $cpforms->gethightext(array('text'=>"Phone Number ",'name'=>"phonenumber2",'value'=>"$rs[rc_pr2_phone]",'view'=>"$view",'only'=>1));
		   $cpforms->gethightext(array('text'=>"Email ",'name'=>"email2",'value'=>"$rs[rc_pr2_email]",'view'=>"$view",'only'=>1));
		   $cpforms->gethightext(array('text'=>"Relationship",'name'=>"relationship2",'value'=>"$rs[rc_pr2_relationship]",'view'=>"$view",'only'=>1));
		   $cpforms->smallline(array('title'=>"3rd Reference"));
		   $cpforms->gethightext(array('text'=>"Company Name ",'name'=>"companyname3",'value'=>"$rs[rc_pr3_cpname]",'view'=>"$view",'only'=>1));
		   $cpforms->gethightext(array('text'=>"Contact Name ",'name'=>"contactname3",'value'=>"$rs[rc_pr3_ctname]",'view'=>"$view",'only'=>1));
		   $cpforms->gethightext(array('text'=>"Phone Number ",'name'=>"phonenumber3",'value'=>"$rs[rc_pr3_phone]",'view'=>"$view",'only'=>1));
		   $cpforms->gethightext(array('text'=>"Email ",'name'=>"email3",'value'=>"$rs[rc_pr3_email]",'view'=>"$view",'only'=>1));
		   $cpforms->gethightext(array('text'=>"Relationship",'name'=>"relationship3",'value'=>"$rs[rc_pr3_relationship]",'view'=>"$view",'only'=>1));

		   //$cpforms->makeselect(array('text'=>"Status",'name'=>"status",'only'=>1,'option'=>$ALLSTATUS,'selected'=>"$rs[rc_status]",'view'=>"$view",'viewfunction'=>'ALLSTATUS'));
     ?>

<?
		
      if($_GET[action]=="view"){$cpforms->noformfooter();}
	   else{ $cpforms->formfooter(array('confirm'=>1));}
}


if($_GET['action'] == 'act'){

	$now = time();
	$thirtydaysbefore = time() - 86400 * 30;
//////////////////30 days

	//messages sent
	$sql = "SELECT COUNT(*) AS count FROM pa_email WHERE 1=1 AND e_sentrcid ='".$_GET[id]."' AND e_senderdel= 0 AND e_created > '".$thirtydaysbefore."' AND e_created < '".$now."'";
	$result = $DB->fetch_one_array($sql);
	$messagesent30 = $result['count'];

	//messages received
	$sql = "SELECT COUNT(*) AS count FROM pa_email WHERE 1=1 AND e_receivedrcid ='".$_GET[id]."' AND e_receiverdel= 0 AND e_created > '".$thirtydaysbefore."' AND e_created < '".$now."'";
	$result = $DB->fetch_one_array($sql);
	$messagereceived30 = $result['count'];

	//candidate added
	$sql = "SELECT COUNT(*) AS count FROM pa_resume WHERE `re_usertype`='recruiter' AND `re_uid`='".$_GET[id]."' AND re_aliasid = '0' AND re_regtime > '".$thirtydaysbefore."' AND re_regtime < '".$now."'";
	$result = $DB->fetch_one_array($sql);
	$candidateadded30 = $result['count'];

	//contact added
	$sql = "SELECT COUNT(*) AS count FROM pa_mycontacts WHERE 1=1 AND myc_rcid = '".$_GET[id]."' AND myc_created > '".$thirtydaysbefore."' AND myc_created < '".$now."'";
	$result = $DB->fetch_one_array($sql);
	$contactadded30 = $result['count'];

	//group added
	$sql = "SELECT COUNT(*) AS count FROM pa_contactgroup WHERE cgp_rcid='".$_GET[id]."' AND cgp_created > '".$thirtydaysbefore."' AND cgp_created < '".$now."'";
	$result = $DB->fetch_one_array($sql);
	$groupadded30 = $result['count'];

	//job posted
	$sql = "SELECT COUNT(*) AS count FROM  pa_job WHERE `jo_utype`='recruiter' AND `jo_uid`='".$_GET[id]."' AND jo_regtime > '".$thirtydaysbefore."' AND jo_regtime < '".$now."'";
	$result = $DB->fetch_one_array($sql);
	$jobposted30 = $result['count'];


	//job approved to work on
	$sql = "SELECT SUM(count) FROM (SELECT COUNT(*) AS count FROM pa_job as a ,pa_contact as b WHERE a.jo_id = b.re_aliasid AND b.re_uid = '".$_GET[id]."' AND (`jo_status` <> '3' AND re_isapproved <> 0)  
	AND b.re_updtime >  '".$thirtydaysbefore."' AND b.re_updtime < '".$now."'
	GROUP BY a.jo_id ) AS t1 ";
	$result = $DB->fetch_one_array($sql);
	$result['count'] = ($result['SUM(count)']>0)?$result['SUM(count)']:0;
	$jobapproved30 = $result['count'];

	//applicants received
	$sql = "SELECT COUNT(*) AS count FROM pa_applicant as a ,pa_resume as b,pa_job as d WHERE d.jo_id = a.app_jobid AND a.app_resumeid = b.re_id AND (a.app_isdelete = 0 OR a.app_isdelete = 2) AND a.app_ownid = '".$_GET[id]."' AND a.app_regtime >  '".$thirtydaysbefore."' AND a.app_regtime < '".$now."' ";
	$result = $DB->fetch_one_array($sql);
	$applicantreceived30 = $result['count'];

	//candidate submitted
	$sql = "SELECT COUNT(*) as count FROM pa_applicant as a ,pa_resume as b,pa_job as d WHERE d.jo_id = a.app_jobid AND a.app_resumeid = b.re_id AND a.app_recruitid = '".$_GET[id]."' AND a.app_regtime >  '".$thirtydaysbefore."' AND a.app_regtime < '".$now."'";
	$result = $DB->fetch_one_array($sql);
	$candidatesubmitted30 = $result['count'];

//////////////////Total

	//messages sent
	$sql = "SELECT COUNT(*) AS count FROM pa_email WHERE 1=1 AND e_sentrcid ='".$_GET[id]."' AND e_senderdel= 0 ";
	$result = $DB->fetch_one_array($sql);
	$messagesentTotal = $result['count'];

	//messages received
	$sql = "SELECT COUNT(*) AS count FROM pa_email WHERE 1=1 AND e_receivedrcid ='".$_GET[id]."' AND e_receiverdel= 0 ";
	$result = $DB->fetch_one_array($sql);
	$messagereceivedTotal = $result['count'];

	//candidate added
	$sql = "SELECT COUNT(*) AS count FROM pa_resume WHERE `re_usertype`='recruiter' AND `re_uid`='".$_GET[id]."' AND re_aliasid = '0'";
	$result = $DB->fetch_one_array($sql);
	$candidateaddedTotal = $result['count'];

	//contact added
	$sql = "SELECT COUNT(*) AS count FROM pa_mycontacts WHERE 1=1 AND myc_rcid = '".$_GET[id]."' ";
	$result = $DB->fetch_one_array($sql);
	$contactaddedTotal = $result['count'];

	//group added
	$sql = "SELECT COUNT(*) AS count FROM pa_contactgroup WHERE cgp_rcid='".$_GET[id]."' ";
	$result = $DB->fetch_one_array($sql);
	$groupaddedTotal = $result['count'];

	//job posted
	$sql = "SELECT COUNT(*) AS count FROM  pa_job WHERE `jo_utype`='recruiter' AND `jo_uid`='".$_GET[id]."' ";
	$result = $DB->fetch_one_array($sql);
	$jobpostedTotal = $result['count'];


	//job approved to work on
	$sql = "SELECT SUM(count) FROM (SELECT COUNT(*) AS count FROM pa_job as a ,pa_contact as b WHERE a.jo_id = b.re_aliasid AND b.re_uid = '".$_GET[id]."' AND (`jo_status` <> '3' AND re_isapproved <> 0)  
	GROUP BY a.jo_id ) AS t1 ";
	$result = $DB->fetch_one_array($sql);
	$result['count'] = ($result['SUM(count)']>0)?$result['SUM(count)']:0;
	$jobapprovedTotal = $result['count'];

	//applicants received
	$sql = "SELECT COUNT(*) AS count FROM pa_applicant as a ,pa_resume as b,pa_job as d WHERE d.jo_id = a.app_jobid AND a.app_resumeid = b.re_id AND (a.app_isdelete = 0 OR a.app_isdelete = 2) AND a.app_ownid = '".$_GET[id]."' ";
	$result = $DB->fetch_one_array($sql);
	$applicantreceivedTotal = $result['count'];

	//candidate submitted
	$sql = "SELECT COUNT(*) as count FROM pa_applicant as a ,pa_resume as b,pa_job as d WHERE d.jo_id = a.app_jobid AND a.app_resumeid = b.re_id AND a.app_recruitid = '".$_GET[id]."'";
	$result = $DB->fetch_one_array($sql);
	$candidatesubmittedTotal = $result['count'];


	echo '<table width="100%" align="center" border="0" cellspacing="1" cellpadding="4" class="tableoutline">
					<tr id="cat">
                          <td class="tbhead">
							 <b> User activities in the last... </b>
                          </td>
						  <td class="tbhead">
							 <b> 30 days </b>
						  </td>
						  <td class="tbhead">
							 <b>Total</b>
						  </td>
                   </tr>
					<tr class="firstalt" nowrap>
					   
	                   <td width="70%"  align ="left"><b>Messages Sent:</b></td>
                       <td>'.$messagesent30.'</td><td>'.$messagesentTotal.'</td>
						</td>
                   </tr>
					<tr class="firstalt" nowrap>
					   
	                   <td width="70%"  align ="left"><b>Messages Received:</b></td>
                       <td>'.$messagereceived30.'</td><td>'.$messagereceivedTotal.'</td>
						</td>
                   </tr>
				   <tr class="firstalt" nowrap>
					   
	                   <td width="70%"  align ="left"><b>Candidates Added:</b></td>
                       <td>'.$candidateadded30.'</td><td>'.$candidateaddedTotal.'</td>
						</td>
                   </tr>
				   <tr class="firstalt" nowrap>
					   
	                   <td width="70%"  align ="left"><b>Contacts Created:</b></td>
                       <td>'.$contactadded30.'</td><td>'.$contactaddedTotal.'</td>
						</td>
                   </tr>
				   <tr class="firstalt" nowrap>
					   
	                   <td width="70%"  align ="left"><b>Groups Created:</b></td>
                       <td>'.$groupadded30.'</td><td>'.$groupaddedTotal.'</td>
						</td>
                   </tr>
				   <tr class="firstalt" nowrap>
					   
	                   <td width="70%"  align ="left"><b>Jobs Posted:</b></td>
                       <td>'.$jobposted30.'</td><td>'.$jobpostedTotal.'</td>
						</td>
                   </tr>
				   <tr class="firstalt" nowrap>
					   
	                   <td width="70%"  align ="left"><b>Jobs Approved to Work On:</b></td>
                       <td>'.$jobapproved30.'</td><td>'.$jobapprovedTotal.'</td>
						</td>
                   </tr>
				   <tr class="firstalt" nowrap>
					   
	                   <td width="70%"  align ="left"><b>Applicants Received:</b></td>
                       <td>'.$applicantreceived30.'</td><td>'.$applicantreceivedTotal.'</td>
						</td>
                   </tr>
				   <tr class="firstalt" nowrap>
					   
	                   <td width="70%"  align ="left"><b>Candidates Submmitted:</b></td>
                       <td>'.$candidatesubmitted30.'</td><td>'.$candidatesubmittedTotal.'</td>
						</td>
                   </tr>
		</table> 
		<input type="button" value="back" onclick="history.go(-1)">
		';
}

if ($_GET[action]=="list"){


	if($_GET[action]=="list"){   
		$nav = new buildNav;

		$total = $DB->fetch_one_array("SELECT COUNT(*) AS count FROM ".$db_prefix."recuiter");

		$nav->total_result = $total[count];
 
		if (empty($total[count])) {
			pa_exit("<font color=red>No recuiter!</font><input type=button value='Add New' onclick='location.href=\"recruiter.php?action=add\"'>");
		}
		$by = "rc_id"; 
		$order = "DESC";
        $_GET[order1]==''&&$order1=1;$_GET[order2]==''&&$order2=1;$_GET[order3]==''&&$order3=1;$_GET[order4]==''&&$order4=1;
		switch($_GET[swh]){
		   case 1:
			   $by = "rc_copname";
               if($_GET[order1]==1){$order1=2; $order=" DESC ";
			   $image1 = "<img src=\"images/dot1.gif\">";}else{$order1=1;$order=" ASC ";
			   $image1 = "<img src=\"images/dot2.gif\">";}
			   break;
           case 2:
               $by = "rc_uname";
               if($_GET[order2]==1){$order2=2; $order=" DESC ";$image2 = "<img src=\"images/dot1.gif\">";}else{$order2=1;$order=" ASC ";$image2 = "<img src=\"images/dot2.gif\">";}
			   break;
		   case 3:
                $by = "rc_fname";
               if($_GET[order3]==1){$order3=2; $order=" DESC ";$image3 = "<img src=\"images/dot1.gif\">";}else{$order3=1;$order=" ASC ";$image3 = "<img src=\"images/dot2.gif\">";}
			   break;
		   case 4:
               $by = "rc_lname";
               if($_GET[order4]==1){$order4=2; $order=" DESC ";$image4 = "<img src=\"images/dot1.gif\">";}else{$order4=1;$order=" ASC ";$image4 = "<img src=\"images/dot2.gif\">";}
			   break;
			case 5:
               $by = "rc_industry";
               if($_GET[order5]==1){$order5=2; $order=" DESC ";$image5 = "<img src=\"images/dot1.gif\">";}else{$order5=1;$order=" ASC ";$image5 = "<img src=\"images/dot2.gif\">";}
			   break;	
			case 6:
               $by = "rc_prifocus";
               if($_GET[order6]==1){$order6=2; $order=" DESC ";$image6 = "<img src=\"images/dot1.gif\">";}else{$order6=1;$order=" ASC ";$image6 = "<img src=\"images/dot2.gif\">";}
			   break;	
			case 7:
               $by = "rc_city";
               if($_GET[order7]==1){$order7=2; $order=" DESC ";$image7 = "<img src=\"images/dot1.gif\">";}else{$order7=1;$order=" ASC ";$image7 = "<img src=\"images/dot2.gif\">";}
			   break;	
			case 8:
               $by = "rc_newsmailist";
               if($_GET[order8]==1){$order8=2; $order=" DESC ";$image8 = "<img src=\"images/dot1.gif\">";}else{$order8=1;$order=" ASC ";$image8 = "<img src=\"images/dot2.gif\">";}
			   break;	
			case 9:
               $by = "rc_regtime";
               if($_GET[order9]==1){$order9=2; $order=" DESC ";$image9 = "<img src=\"images/dot1.gif\">";}else{$order9=1;$order=" ASC ";$image9 = "<img src=\"images/dot2.gif\">";}
			   break;	
			case 10:
               $by = "rc_status";
               if($_GET[order10]==1){$order10=2; $order=" DESC ";$image10 = "<img src=\"images/dot1.gif\">";}else{$order10=1;$order=" ASC ";$image10 = "<img src=\"images/dot2.gif\">";}
			   break;	
			case 11:
               $by = "rc_id";
               if($_GET[order11]==1){$order11=2; $order=" DESC ";$image10 = "<img src=\"images/dot1.gif\">";}else{$order11=1;$order=" ASC ";$image10 = "<img src=\"images/dot2.gif\">";}
			   break;	
		}
		
		$order = " ORDER BY $by $order";
		$nav->execute("SELECT * FROM ".$db_prefix."recuiter $order");

    }
	
	echo $nav->title("Recruiter list");
    echo $nav->pagenav();

    echo "<table border=\"0\" width=\"100%\" cellpadding=\"4\" cellspacing=\"1\" class=\"tableoutline\">
	<script type=\"text/javascript\" src=\"http://download.skype.com/share/skypebuttons/js/skypeCheck.js\"></script>
	           <tr><td colspan=7><input type=button value=\"Add New Recruiter\" onclick=\"location.href='recruiter.php?action=add'\"></td></tr>
               <tr align=\"center\" class=\"tbhead\">
				<td nowrap  width=\"6%\"><a href=\"recruiter.php?action=list&offset=$_GET[offset]&order1=$order1&swh=1\">$image1 Company </a></td>
				<td nowrap  width=\"6%\">Service Code</td>
				<td nowrap  width=\"6%\"><a href=\"recruiter.php?action=list&offset=$_GET[offset]&order11=$order11&swh=11\">$image11 User ID</a></td> 
			    <td nowrap  width=\"6%\"><a href=\"recruiter.php?action=list&offset=$_GET[offset]&order2=$order2&swh=2\">$image2 Username </a></td>
                <td nowrap  width=\"6%\"><a href=\"recruiter.php?action=list&offset=$_GET[offset]&order3=$order3&swh=3\">$image3 Firstname </a></td>
			    <td nowrap  width=\"6%\"><a href=\"recruiter.php?action=list&offset=$_GET[offset]&order4=$order4&swh=4\">$image4 Lastname </a></td>
                <td nowrap  width=\"10%\"><a href=\"recruiter.php?action=list&offset=$_GET[offset]&order5=$order5&swh=5\">$image5 Industry </a></td>
                <td nowrap  width=\"10%\"><a href=\"recruiter.php?action=list&offset=$_GET[offset]&order6=$order6&swh=6\">$image6 Specialty </a></td>
				<td nowrap  width=\"10%\"><a href=\"recruiter.php?action=list&offset=$_GET[offset]&order7=$order7&swh=7\">$image7 Service Location </a></td>
			    <td nowrap  width=\"10%\"> Email </td>
			    <td nowrap  width=\"10%\"><a href=\"recruiter.php?action=list&offset=$_GET[offset]&order8=$order8&swh=8\">$image8 Newsletter </a></td>
                <td nowrap  width=\"10%\"><a href=\"recruiter.php?action=list&offset=$_GET[offset]&order9=$order9&swh=9\">$image9 Register Date </a></td>
				<td nowrap  width=\"10%\"><a href=\"recruiter.php?action=list&offset=$_GET[offset]&order10=$order10&swh=10\">$image10 Member Status</a></td> 
				<td nowrap  width=\"10%\"> Action </td>
               </tr>\n";
    while ($list = $DB->fetch_array($nav->sql_result)){

	       if($list[rc_newsmailist]==1){$newslist = "Yes" ;}else{$newslist = "No" ;}
           echo "<tr class=".getrowbg().">
		              <td align=\"left\">".$list[rc_copname]."</td>
					  <td align=\"left\">".$list[rc_servicecode]."</td>
					  <td align=\"left\">".$list[rc_id]."</td>
					  <td align=\"left\">".$list[rc_uname]."</td>
                      <td align=\"left\">".$list[rc_fname]."</td>
					  <td align=\"left\">".$list[rc_lname]."</td>
                      <td align=\"left\">".$jobcategory[$list[rc_industry]]."</td>
					  <td align=\"left\">".$jobfunction[$list[rc_recruit]]."</td>
					  <td align=\"left\">".$list[rc_city]." ".$state[$list[rc_state]]." ".$country[$list[rc_country]]."</td>
					  <td align=\"left\">".$list[rc_email]."</td>
					  <td align=\"left\">".$newslist."</td>
					  <td align=\"left\">".date('m/d/Y',$list[rc_regtime])."</td>
					  <td align=\"left\"><select name=\"status\" onchange=\"changestatus('recruiter.php','".$list[rc_id]."',this.options[this.options.selectedIndex].value)\">
						  <option value='0' ";
					if($list[rc_status]==0) echo " selected ";
			              echo ">Starter</option>
						  <option value='1' ";
					if($list[rc_status]==1) echo " selected ";
			              echo ">Director</option>
						  <option value='2' ";
					if($list[rc_status]==2) echo " selected ";
			              echo ">Executive</option>
						  <option value='3' ";
					if($list[rc_status]==3) echo " selected ";
			              echo ">Premium</option>
						  <option value='4' ";
					if($list[rc_status]==4) echo " selected ";
			              echo ">Expired</option></select></td>
                      <td align=\"left\" nowrap><a href=\"recruiter.php?action=view&offset=$_GET[offset]&id=$list[rc_id]\">Detail</a> |
					  <a href=\"recruiter.php?action=act&offset=$_GET[offset]&id=$list[rc_id]\">Activities</a> | <a href=\"recruiter.php?action=mod&offset=$_GET[offset]&id=$list[rc_id]\">Edit</a> | <a href=\"recruiter.php?action=kill&offset=$_GET[offset]&id=$list[rc_id]\">Delete</a>";
    }
	if(empty($total[count])){
			echo "<tr><td><font color=red>No results!</font></td></tr>";
   }
    echo "</table>\n";
    echo $nav->pagenav();
}

if ($_GET[action]=="kill"){
    $cpforms->formheader(array('title'=>'Sure to delete this?'));
    $cpforms->makehidden(array('name'=>'action',
                                'value'=>'remove'));
    $cpforms->makehidden(array('name'=>'recuiterid',
                                'value'=>$_GET[id]));
	$cpforms->makehidden(array('name'=>'offset',
                                'value'=>$_GET[offset]));
    $cpforms->formfooter(array('confirm'=>2));
}


if( $_POST[action]=="remove"){
    $DB->query("DELETE FROM ".$db_prefix."recuiter WHERE rc_id='$_POST[recuiterid]'");
    redirect("./recruiter.php?action=list&offset=".$offset,"<font color=red>Deleted Successfully!</font>");
}



if ($_POST[action]=="doinsert"){
	
	$username       = htmlspecialchars(trim($_POST[user_name]));
	$password       = md5(trim($_POST[password]));
	$firstname      = htmlspecialchars(trim($_POST[firstname]));
	$lastname       = htmlspecialchars(trim($_POST[lastname]));
	$email          = htmlspecialchars(trim($_POST[email]));
	$phone          = htmlspecialchars(trim($_POST[phone]));
	$fax            = htmlspecialchars(trim($_POST[fax]));
	$jobtitle       = htmlspecialchars(trim($_POST[jobtitle]));
	$skype          = htmlspecialchars(trim($_POST[skype]));
	$spokenlanguage = htmlspecialchars(trim($_POST[spokenlanguage]));
	$newsmailist    = htmlspecialchars(trim($_POST[newsmailist]));
	$recruitex      = htmlspecialchars(trim($_POST[recruitex]));
	$description    = ucfirst(htmlspecialchars(trim($_POST[description])));
	$howus          = htmlspecialchars(trim($_POST[howus]));
	$servicecode    = htmlspecialchars(trim($_POST[servicecode]));
    $companyname    = htmlspecialchars(trim($_POST[companyname]));
	$companyurl     = htmlspecialchars(trim($_POST[companyurl]));
	$industry       = htmlspecialchars(trim($_POST[industry]));
	$companysize    = htmlspecialchars(trim($_POST[companysize]));
	$address        = htmlspecialchars(trim($_POST[address]));
	$locity         = htmlspecialchars(trim($_POST[locity]));
	$lostate        = htmlspecialchars(trim($_POST[lostate]));
    $zip            = htmlspecialchars(trim($_POST[zip]));
	$locountry      = htmlspecialchars(trim($_POST[locountry]));
	$generalarea    = htmlspecialchars(trim($_POST[generalarea]));
	$pristate       = htmlspecialchars(trim($_POST[pristate]));
	$pricountry     = htmlspecialchars(trim($_POST[pricountry]));
	$indicate       = htmlspecialchars(trim($_POST[indicate]));
	$recruit        = htmlspecialchars(trim($_POST[recruit]));
	$share          = htmlspecialchars(trim($_POST[share]));
	$business       = htmlspecialchars(trim($_POST[business]));
	$myclient1      = htmlspecialchars(trim($_POST[myclient1]));
	$myclient2      = htmlspecialchars(trim($_POST[myclient2]));
	$myclient3      = htmlspecialchars(trim($_POST[myclient3]));
	$myonline1      = htmlspecialchars(trim($_POST[myonline1]));
	$myonline2      = htmlspecialchars(trim($_POST[myonline2]));
	$myonline3      = htmlspecialchars(trim($_POST[myonline3]));
	$myfavoritet1   = htmlspecialchars(trim($_POST[myfavoritet1]));
	$myfavoritet2   = htmlspecialchars(trim($_POST[myfavoritet2]));
	$myfavoritet3   = htmlspecialchars(trim($_POST[myfavoritet3]));	
	$myprofession1  = htmlspecialchars(trim($_POST[myprofession1]));
	$myprofession2  = htmlspecialchars(trim($_POST[myprofession2]));
	$myprofession3  = htmlspecialchars(trim($_POST[myprofession3]));

	$licensenumber       = htmlspecialchars(trim($_POST[licensenumber]));
	$licenseissue        = htmlspecialchars(trim($_POST[licenseissue]));
	$licensephone        = htmlspecialchars(trim($_POST[licensephone]));
    $companyname1        = htmlspecialchars(trim($_POST[companyname1]));
    $contactname1        = htmlspecialchars(trim($_POST[contactname1]));
    $phonenumber1        = htmlspecialchars(trim($_POST[phonenumber1]));
	$email1              = htmlspecialchars(trim($_POST[email1]));
    $relationship1       = htmlspecialchars(trim($_POST[relationship1]));
	$companyname2        = htmlspecialchars(trim($_POST[companyname2]));
    $contactname2        = htmlspecialchars(trim($_POST[contactname2]));
    $phonenumber2        = htmlspecialchars(trim($_POST[phonenumber2]));
	$email2              = htmlspecialchars(trim($_POST[email2]));
    $relationship2       = htmlspecialchars(trim($_POST[relationship2]));
	$companyname3        = htmlspecialchars(trim($_POST[companyname3]));
    $contactname3        = htmlspecialchars(trim($_POST[contactname3]));
    $phonenumber3        = htmlspecialchars(trim($_POST[phonenumber3]));
	$email3              = htmlspecialchars(trim($_POST[email3]));
    $relationship3       = htmlspecialchars(trim($_POST[relationship3]));


    if ($username=="") {
        pa_exit("<font color=red>Please enter the username!</font>");
    }
	if ($email=="") {
        pa_exit("<font color=red>Please enter the email!</font>");
    }
   
	$sql_1  = " select ep_uname,ep_pword from pa_employer where ep_uname = '".$username."' ";
	$arr1 = $DB->fetch_one_array($sql_1);
	$sql_2  = " select js_uname,js_pword from pa_candidates where js_uname ='".$username."'";
	$arr2 = $DB->fetch_one_array($sql_2);
	$sql_3  = " select rc_uname,rc_pword from pa_recuiter where rc_uname ='".$username."'";
	$arr3 = $DB->fetch_one_array($sql_3);
	$sql_4  = " select ad_uname,ad_pword from pa_advisory where ad_uname ='".$username."'";
	$arr4 = $DB->fetch_one_array($sql_4);

	if($_FILES["uploadfile"][name]!=''){
	   $f = new upfile("../uploadfiles/recruiter/","gif,jpg,png");
	  if($f->upload("uploadfile")){
		 $filename1 = $f->savename;
		 $filename1p = $filename1;
		 //切割
		 if(file_exists("../uploadfiles/recruiter/".$filename1)){
			$big_image_name = "../uploadfiles/recruiter/".$filename1;
			$filename1 = substr($filename1, 0, -4);
			$cutbig = "../uploadfiles/recruiter/".$filename1;
			@miniature($big_image_name, $cutbig, $max_width = 100, $max_height = 100, $resize = 1);
		 } 
	   }
	}

    $deadline = $deadline_conf + time();
	if(empty($arr1)&&empty($arr2)&&empty($arr3)&&empty($arr4)){
			$date = date("Y-m-d",time());
			$sql = "INSERT INTO `pa_recuiter` ( `rc_servicecode`, `rc_uname`, `rc_pword`, `rc_copname`, `rc_fname`, `rc_lname`, `rc_title`, `rc_address1`, `rc_industry`, `rc_copsize`, `rc_country`, `rc_howus`, `rc_newsmailist`, `rc_generalarea`, `rc_pristate`, `rc_pricountry`, `rc_indicate`, `rc_recruit`, `rc_spokenlanguage`, `rc_recruitex`,`rc_uploadfile`, `rc_skype`, `rc_state`, `rc_city`, `rc_zip`, `rc_phone`, `rc_fax`, `rc_mobphone`, `rc_email`, `rc_website`, `rc_regtime`, `rc_deadline`, `rc_description`, `rc_share`,`rc_business`,`rc_status`, `rc_top3_1`,`rc_license`, `rc_license_Issue`, `rc_license_office`, `rc_pr1_cpname`, `rc_pr1_ctname`, `rc_pr1_phone`, `rc_pr1_email`, `rc_pr1_relationship`, `rc_pr2_cpname`, `rc_pr2_ctname`, `rc_pr2_phone`, `rc_pr2_email`, `rc_pr2_relationship`, `rc_pr3_cpname`, `rc_pr3_ctname`, `rc_pr3_phone`, `rc_pr3_email`, `rc_pr3_relationship`) VALUES ( '".$servicecode."', '".$username."', '".$password."', '".$companyname."', '".$firstname."', '".$lastname."', '".$jobtitle."', '".$address."', '".$industry."', '".$companysize."', '".$locountry."', '".$howus."', '".$newsmailist."', '".$generalarea."', '".$pristate."', '".$pricountry."', '".$indicate."', '".$recruit."', '".$spokenlanguage."', '".$recruitex."', '".$filename1p."', '".$skype."', '".$lostate ."', '".$locity."', '".$zip."', '".$phone."', '".$fax."', '".$mobilephone."', '".$email."', '".$companyurl."', '".time()."', '".$deadline."', '".$description."','".$share."','".$business."','0', '".$myclient1."', '".$licensenumber."', '".$licenseissue."', '".$licensephone."', '".$companyname1."', '".$contactname1."', '".$phonenumber1."','".$email1."', '".$relationship1."', '".$companyname2."', '".$contactname2."', '".$phonenumber2."','".$email2."' ,'".$relationship2."', '".$companyname3."', '".$contactname3."', '".$phonenumber3."','".$email2."', '".$relationship3."');";

			
			
			$DB->query($sql);
	}else{
	         pa_exit("<h3 style=\"color:red\">The username is already taken. Please choose another one.</h3>");
	}
    redirect("./recruiter.php?action=list","<font color=red>Added Successfully!</font>");
}


if ($_POST[action]=="update"){

	$password       = md5(trim($_POST[password]));
	$firstname      = htmlspecialchars(trim($_POST[firstname]));
	$lastname       = htmlspecialchars(trim($_POST[lastname]));
	$email          = htmlspecialchars(trim($_POST[email]));
	$phone          = htmlspecialchars(trim($_POST[phone]));
	$fax            = htmlspecialchars(trim($_POST[fax]));
	$jobtitle       = htmlspecialchars(trim($_POST[jobtitle]));
	$skype          = htmlspecialchars(trim($_POST[skype]));
	$spokenlanguage = htmlspecialchars(trim($_POST[spokenlanguage]));
	$newsmailist    = htmlspecialchars(trim($_POST[newsmailist]));
	$recruitex      = htmlspecialchars(trim($_POST[recruitex]));
	$description    = ucfirst(htmlspecialchars(trim($_POST[description])));
	$howus          = htmlspecialchars(trim($_POST[howus]));
	$servicecode    = htmlspecialchars(trim($_POST[servicecode]));
    $companyname    = htmlspecialchars(trim($_POST[companyname]));
	$companyurl     = htmlspecialchars(trim($_POST[companyurl]));
	$industry       = htmlspecialchars(trim($_POST[industry]));
	$companysize    = htmlspecialchars(trim($_POST[companysize]));
	$address        = htmlspecialchars(trim($_POST[address]));
	$locity         = htmlspecialchars(trim($_POST[locity]));
	$lostate        = htmlspecialchars(trim($_POST[lostate]));
    $zip            = htmlspecialchars(trim($_POST[zip]));
	$locountry      = htmlspecialchars(trim($_POST[locountry]));
	$generalarea    = htmlspecialchars(trim($_POST[generalarea]));
	$pristate       = htmlspecialchars(trim($_POST[pristate]));
	$pricountry     = htmlspecialchars(trim($_POST[pricountry]));
	$indicate       = htmlspecialchars(trim($_POST[indicate]));
	$recruit        = htmlspecialchars(trim($_POST[recruit]));
	$share          = htmlspecialchars(trim($_POST[share]));
	$business       = htmlspecialchars(trim($_POST[business]));
	$myclient1      = htmlspecialchars(trim($_POST[myclient1]));

	if($_FILES["uploadfile"][name]!=''){
	   $f = new upfile("../uploadfiles/recruiter/","gif,jpg,png");
	   if($f->upload("uploadfile")){
		 $filename = $f->savename;
		 $upload = "`rc_uploadfile` = '$filename',";
		 if(file_exists("../uploadfiles/recruiter/".$filename1)){
			$big_image_name = "../uploadfiles/recruiter/".$filename1;
			$filename1 = substr($filename1, 0, -4);
			$cutbig = "../uploadfiles/recruiter/".$filename1;
			@miniature($big_image_name, $cutbig, $max_width = 100, $max_height = 100, $resize = 1);
		 } 
	   }
	}
	if($_POST[password]){
	  $pwd =  "`rc_pword`='$password' ,";
	}

      $sql = "UPDATE ".$db_prefix."recuiter 
	                 SET 
					 ".$pwd."
                    `rc_copname`='".$companyname."' ,
					`rc_servicecode`='".$servicecode."',
					`rc_fname`='".$firstname."'  ,
				    `rc_lname`='".$lastname."'  ,
				    `rc_title`='".$jobtitle."'  ,
					`rc_address1`='".$address."' ,
					`rc_industry`='".$industry."' ,
					`rc_copsize` ='".$companysize."' , 
					`rc_country`='".$locountry."' , 
					`rc_howus`='".$howus."' ,
					`rc_newsmailist`='".$newsmailist."',
					`rc_prifocus`='".$prifocus."' , 
					`rc_generalarea`='".$generalarea."' ,
					`rc_pristate`='".$pristate."' ,
					`rc_pricountry`='".$pricountry."' , 
					`rc_indicate`='".$indicate."' ,
					`rc_recruit`='".$recruit."',
					`rc_spokenlanguage`='".$spokenlanguage."' , 
					`rc_recruitex`='".$recruitex."' , 
					`rc_share`='".$share."' , 
					`rc_business`='".$business."' , 
					`rc_zip` = '".$zip."',
					".$upload."
					`rc_skype`='".$skype."' ,
					`rc_state`='".$lostate."' , 
					`rc_city`= '".$locity."', 
					`rc_phone`='".$phone."' ,
					`rc_fax`='".$fax."'  ,
					`rc_email`='".$email."' , 
					`rc_website`='".$companyurl."' , 
					`rc_description`= '".$description."',	
					`rc_top3_1`='".$myclient1."'
					WHERE rc_id= '".$_POST[id]."'";

	$DB->query($sql);

	$rc_license              = htmlspecialchars(trim($_POST[licensenumber]));
	$rc_license_Issue        = htmlspecialchars(trim($_POST[licenseissue]));
	$rc_license_office       = htmlspecialchars(trim($_POST[licensephone]));
    $rc_pr1_cpname           = htmlspecialchars(trim($_POST[companyname1]));
    $rc_pr1_ctname           = htmlspecialchars(trim($_POST[contactname1]));
    $rc_pr1_phone            = htmlspecialchars(trim($_POST[phonenumber1]));
    $rc_pr1_email            = htmlspecialchars(trim($_POST[email1]));
	$rc_pr1_relationship     = htmlspecialchars(trim($_POST[relationship1]));
    $rc_pr2_cpname           = htmlspecialchars(trim($_POST[companyname2]));
    $rc_pr2_ctname           = htmlspecialchars(trim($_POST[contactname2]));
    $rc_pr2_phone            = htmlspecialchars(trim($_POST[phonenumber2]));
    $rc_pr2_email            = htmlspecialchars(trim($_POST[email2]));
	$rc_pr2_relationship     = htmlspecialchars(trim($_POST[relationship2]));
    $rc_pr3_cpname           = htmlspecialchars(trim($_POST[companyname3]));
    $rc_pr3_ctname           = htmlspecialchars(trim($_POST[contactname3]));
    $rc_pr3_phone            = htmlspecialchars(trim($_POST[phonenumber3]));
    $rc_pr3_email            = htmlspecialchars(trim($_POST[email3]));
	$rc_pr3_relationship     = htmlspecialchars(trim($_POST[relationship3]));
   
    $sql = "UPDATE ".$db_prefix."recuiter 
	                 SET 
                    `rc_license`              ='".$rc_license."' ,
					`rc_license_Issue`        ='".$rc_license_Issue."',
					`rc_license_office`       ='".$rc_license_office."'  ,
					`rc_pr1_cpname`           ='".$rc_pr1_cpname."',
					`rc_pr1_ctname`           ='".$rc_pr1_ctname."',
					`rc_pr1_phone`            ='".$rc_pr1_phone."',
					`rc_pr1_email`            ='".$rc_pr1_email."',
					`rc_pr1_relationship`     ='".$rc_pr1_relationship."',
					`rc_pr2_cpname`           ='".$rc_pr2_cpname."',
					`rc_pr2_ctname`           ='".$rc_pr2_ctname."',
					`rc_pr2_phone`            ='".$rc_pr2_phone."',
					`rc_pr2_email`            ='".$rc_pr2_email."',
					`rc_pr2_relationship`     ='".$rc_pr2_relationship."',
					`rc_pr3_cpname`           ='".$rc_pr3_cpname."',
					`rc_pr3_ctname`           ='".$rc_pr3_ctname."',
					`rc_pr3_phone`            ='".$rc_pr3_phone."',
					`rc_pr3_email`            ='".$rc_pr3_email."',
					`rc_pr3_relationship`     ='".$rc_pr3_relationship."'
					WHERE rc_id= '".$_POST[id]."'";
	$DB->query($sql);
    redirect("./recruiter.php?action=list&offset=".$offset,"<font color=red>Modified Successfully!</font>");
}
cpfooter();
?>